package cz.acies.uniql.sql;

import java.io.Serializable;

import cz.acies.uniql.sql.SelectQuery;

public class UnionQueryElement implements Serializable
{
	private static final long serialVersionUID = 3984737757056362909L;
	
	private SelectQuery query;
	private String option;

	UnionQueryElement() {}

	UnionQueryElement(SelectQuery query) {
		this(query, "");
	}

	UnionQueryElement(SelectQuery query, String option) {
		this.query = query;
		setOption(option);
	}

	public SelectQuery getQuery() {
		return query;
	}

	public void setQuery(SelectQuery query) {
		this.query = query;
	}

	public String getOption() {
		return option;
	}

	public void setOption(String option) {
		if (option != null) {
			option = option.toUpperCase();
			if (!option.equals("DISTINCT") && !option.equals("ALL")) {
				option = "";
			} 
		}
		this.option = option;
	}
}
